#include "stdafx.h"
#include "ASN1Null.h"

typedef std::pair<int, std::vector<byte>> nullEncodingParam;

class ASN1NullEncodingTestCase : public ::testing::TestWithParam<nullEncodingParam>
{
};

TEST_P(ASN1NullEncodingTestCase, Encode)
{
	AppliedCryptography::ASN1Null val;
	std::vector<byte> ret;
	std::vector<byte> expected(GetParam().second);

	ret = val.encode();

	// Output size should be as expected
	ASSERT_EQ(expected.size(), ret.size()) << "Value: " << val.get();

	for(unsigned int i = 0; i < expected.size(); ++i)
	{
		EXPECT_NO_THROW(EXPECT_EQ((int)expected.at(i), (int)ret.at(i)) 
			<< "Index i: " << i << "\n"
			<< "Value: " << val.get());
	};
};

byte bytesNull[] = {0x05, 0x00};
std::vector<byte> vectNull(bytesNull, bytesNull + sizeof(bytesNull) / sizeof(byte));

INSTANTIATE_TEST_CASE_P(ASN1NullEncodingTest,
                        ASN1NullEncodingTestCase,
						::testing::Values( 
							nullEncodingParam(1, vectNull) )
						);
